from rest_framework import serializers
from .models import *


class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ["username", "password", "phone", "code"]

    def create(self, validated_data):
        return User.objects.create_user(**validated_data)


class CodeSerializer(serializers.ModelSerializer):
    class Meta:
        model = Code
        fields = ["phone"]
